package cn.ywsj.ywsjmidtier.controller;

import cn.ywsj.ywsjmidtier.entity.VO.*;
import cn.ywsj.ywsjmidtier.service.WechatApprovalSettingFeign;
import cn.ywsj.ywsjmidtier.utils.JsonObjectUtil;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName : WechatApprovalSettingController
 * @Author : Lenovo
 * @Date: 2021/7/23 13:39
 * @Description :
 */
@RestController
@RequestMapping("/wechat/member/approvalsettingmgr")
public class WechatApprovalSettingController {
    @Autowired
    private WechatApprovalSettingFeign wechatApprovalSettingFeign;
    @GetMapping("/toapprovalflow")
    public String toApprovalFlow(){
        return wechatApprovalSettingFeign.toApprovalFlow();
    }
    @RequestMapping("/toalluser")
    public String toAllUser(HttpServletRequest req){
      return wechatApprovalSettingFeign.toAllUser(req);
    }
    @RequestMapping("/getalluser")
    public String getAllUser(UserInfoQueryVo userInfoQueryVo){
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(userInfoQueryVo);
        return wechatApprovalSettingFeign.getAllUser(jsonObject);

    }

    @RequestMapping("/toallbuyer")
    public String toAllBuyer(HttpServletRequest req) {
        return wechatApprovalSettingFeign.toAllBuyer(req);
    }

    @RequestMapping("/getallbuyer")
    public String getAllBuyer(UserInfoQueryVo userInfoQueryVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(userInfoQueryVo);
        return wechatApprovalSettingFeign.getAllBuyer(jsonObject);
    }

    @RequestMapping("/toqueryallbuyer")
    public String toQueryAllBuyer(HttpServletRequest req) {
        return wechatApprovalSettingFeign.toQueryAllBuyer(req);
    }

    @RequestMapping("/queryallbuyer")
    public String queryAllBuyer(ApprovalFlowQueryVo approvalFlowQueryVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowQueryVo);
        return wechatApprovalSettingFeign.queryAllBuyer(jsonObject);
    }

    @RequestMapping("/addapprovalflow")
    public String addApprovalFlow(ApprovalFlowVo approvalFlowVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowVo);
        return wechatApprovalSettingFeign.addApprovalFlow(jsonObject);
    }

    @RequestMapping("/saveapprovalflow")
    public String saveApprovalFlow(ApprovalFlowVo approvalFlowVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowVo);
        return wechatApprovalSettingFeign.saveApprovalFlow(jsonObject);
    }

    @GetMapping("/toupdateapprovalflow")
    public String toUpdateApprovalFlow(ApprovalFlowListQueryVo approvalFlowListQueryVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowListQueryVo);
        return wechatApprovalSettingFeign.toUpdateApprovalFlow(jsonObject);
    }

    @RequestMapping("/updateapprovalflow")
    public String updateApprovalFlow(ApprovalFlowVo approvalFlowVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowVo);
        return wechatApprovalSettingFeign.updateApprovalFlow(jsonObject);
    }

    @RequestMapping("/deleteapprovalflow")
    public String deleteApprovalFlow(ApprovalFlowListVo approvalFlowListVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowListVo);
        return wechatApprovalSettingFeign.deleteApprovalFlow(jsonObject);
    }

    @RequestMapping("/modifyapprovalflow")
    public String modifyApprovalFlow(ApprovalFlowVo approvalFlowVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowVo);
        return wechatApprovalSettingFeign.modifyApprovalFlow(jsonObject);
    }

    @RequestMapping("/toapprovalflowlist")
    public String toApprovalFlowList(HttpServletRequest req) {
        return wechatApprovalSettingFeign.toApprovalFlowList(req);
    }

    @RequestMapping("/queryapprovalflowlist")
    public String queryApprovalFlowList(ApprovalFlowListQueryVo approvalFlowListQueryVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowListQueryVo);
        return wechatApprovalSettingFeign.queryApprovalFlowList(jsonObject);
    }

    @GetMapping("/ajaxselectapprovalflow")
    public String selectApprovalFlowList(ApprovalFlowListQueryVo approvalFlowListQueryVo) {
        JSONObject jsonObject = JsonObjectUtil.ObjectToJson(approvalFlowListQueryVo);
        return wechatApprovalSettingFeign.selectApprovalFlowList(jsonObject);
    }
}
